import {NgModule} from '@angular/core';
import {Routes, RouterModule} from "@angular/router";
import {GoodsComponent} from "@goods/goods.component";
import {GoodsDetailComponent} from "@goods/goods-detail/goods-detail.component";
import {GoodsListComponent} from "@goods/goods-list/goods-list.component";
import {GoodsFaqComponent} from "@goods/goods-faq/goods-faq.component";
import {GoodsNavComponent} from "@goods/goods-nav/goods-nav.component";
import {GoodsTopicComponent} from './goods-topic/goods-topic.component';
import {GoodsDetailsResolver} from "@goods/goods-detail/goods-detail.resolver";
import {GoodsCouponComponent} from "@goods/goods-coupon/goods-coupon.component";
import {CouponDetailComponent} from "@goods/goods-coupon/coupon-detail/coupon-detail.component";
import {CouponExplainComponent} from "@goods/goods-coupon/coupon-explain/coupon-explain.component";


import {ServiceCardExplainComponent
} from "@goods/service-card/service-card-explain/service-card-explain.component";
import {ServiceCardListComponent} from "@goods/service-card/service-card-list/service-card-list.component";
import {OrdinaryServiceDetailComponent} from "@goods/ordinary/ordinary-service-detail/ordinary-service-detail.component";
import {GoodsTicketModule} from "@goods/goods-ticket/goods-ticket.module";


export const routes: Routes = [
  {
    path: '',
    children: [
      {
        path: 'manage',
        component: ServiceCardListComponent   // 服务卡列表
      },
      {
        path: 'detail/:goodsCode',
        component: GoodsDetailComponent,
        resolve: {
          goodsDetails: GoodsDetailsResolver,
        },
      },
      {
        path: 'list/:goodsCategoryCode',
        component: GoodsListComponent,
      },
      {
        path: 'faq',
        component: GoodsFaqComponent,
      },
      {
        path: 'nav',
        component: GoodsNavComponent,
      },
      {
        path: 'topic/:topicId',
        component: GoodsTopicComponent,
      },
      {
        path: 'coupon/explain',
        component: CouponExplainComponent
      },
      {
        path: 'coupons/self/:id', // type为self：我的优惠券  ;
        component: GoodsCouponComponent
      },
      {
        path: 'coupon/:codeId',
        component: CouponDetailComponent
      },

      {
        path: 'explain',
        component: ServiceCardExplainComponent  // 服務卡説明
      },
      {
        path: 'p', // 票务定向服务卡,
        loadChildren: 'app/pages/goods/goods-ticket/goods-ticket.module#GoodsTicketModule'
      },
      {
        path: 'o', // 普通商品服务卡详情
        component: OrdinaryServiceDetailComponent
      },
    ]
  }
];

@NgModule({
  imports: [
    RouterModule.forChild(routes)
  ],
  exports: [RouterModule]
})
export class GoodsRoutingModule {
}
